<template lang="pug">
dialogModel(
    ref="dialogLoad"
    title="预览"
    width="1280"
    :footer="false"
)
    .cont-wrap
        pdfView(:src="fileUrl"  v-if="fileType=='pdf'" :allFullScreen="false" :showClose="true" @close="dialogLoad.close()")
        wordView(:src="fileUrl"  v-if="fileType=='doc'||fileType=='docx'" :allFullScreen="false" :showClose="true" @close="dialogLoad.close()")
        excelView(:src="fileUrl"  v-if="fileType=='xlsx'||fileType=='xls'")
</template>

<script setup>
import { ref, onMounted } from 'vue'
import pdfView from '@/components/pdfView.vue'
import wordView from '@/components/wordView.vue'
import excelView from '@/components/excelView.vue'
import dialogModel from '@/components/dialogModel.vue'
import apis from '@/apis'
import { success, confirm } from '@/utils/message'
import { storageGet } from '@/utils'
const dialogLoad = ref(null)
const open = (data) =>{
    dialogLoad.value.open()
    fileUrl.value = ''
    fileType.value = data.fileExt
    setTimeout(()=>{
        fileUrl.value = window.Config.baseURL + '/api/cyFile/downloadById?type=2&id=' + (data.fileId || data.id) + '&accessToken=' + storageGet('token')
        console.log(fileUrl.value)
    }, 100)
}

const fileType = ref('')
const fileUrl = ref('')
const fileView = () => {
}
defineExpose({
    open
})

</script>

<style lang="less" scoped>
.cont-wrap{
    height: calc(100vh - 5px);
    :deep(#sidebarResizer){
        display: block;
    }
}
:deep(.el-dialog){
    width: 100vw;
    padding: 0;
    height: 100vh;
    .el-dialog__header{
        display: none;
    }
    .el-dialog__body{
        padding: 0 !important;
    }
}
</style>